<?php
	/**
	Processes opening a new chat
	
	@author Joseph Fehrman
	*/
	$username = $_COOKIE['username'];
	$otherUsers;
	include_once("../db/connection.php");
	if(isset($_POST['other_users'])){
		$otherUsers = $_POST['other_users'];
	}
	$sqlCreateChat = "INSERT INTO chat (chat_text) values ('')";
	mysqli_query($conn, $sqlCreateChat) OR die("Error on query: " . $sqlCreateChat);
	$chatRoom = mysqli_insert_id($conn);
	
	$sqlCreateRel = "INSERT INTO chat_rel (username, chatID) values ('$username', '$chatRoom')";
	mysqli_query($conn, $sqlCreateRel) OR die("Error on query: " . $sqlCreateRel);
	header("Location: ../index.php");
?>